﻿using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Text.RegularExpressions;

namespace DemoApp.Model
{
    /// <summary>
    /// Represents a customer of a company.  This class
    /// has built-in validation logic. It is wrapped
    /// by the CustomerViewModel class, which enables it to
    /// be easily displayed and edited by a WPF user interface.
    /// </summary>
    public class Customer 
    {
        #region Creation

        public static Customer CreateNewCustomer()
        {
            return new Customer();
        }

        public static Customer CreateCustomer(
            double totalSales,
            string firstName,
            string lastName,
            bool isCompany,
            string email)
        {
            return new Customer
            {
                TotalSales = totalSales,
                FirstName = firstName,
                LastName = lastName,
                IsCompany = isCompany,
                Email = email
            };
        }

        protected Customer()
        {
        }

        #endregion // Creation

        #region State Properties

        /// <summary>
        /// Gets/sets the e-mail address for the customer.
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// Gets/sets the customer's first name.  If this customer is a 
        /// company, this value stores the company's name.
        /// </summary>
        public string FirstName { get; set; }

        /// <summary>
        /// Gets/sets whether the customer is a company or a person.
        /// The default value is false.
        /// </summary>
        public bool IsCompany { get; set; }

        /// <summary>
        /// Gets/sets the customer's last name.  If this customer is a 
        /// company, this value is not set.
        /// </summary>
        public string LastName { get; set; }

        /// <summary>
        /// Returns the total amount of money spent by the customer.
        /// </summary>
        public double TotalSales { get; private set; }

        #endregion // State Properties

       
    }
}